<?php

namespace tools\lib\main\controller;

use tools\lib\main\Common;

/**
 * 创建service
 * Class Service
 * @package app\common\command\create
 */
class Service extends Common
{
    public function template()
    {
        $template = <<<EOT
<?php

{$this->getFileNamespace()}

{$this->getFileUse()}

class {$this->className()} {$this->getFileExtends()}
{
    public function getList()
    {
    
    }
    
    public function getInfo(\$id)
    {
    
    }
}
EOT;
        return $template;
    }

    protected function callback()
    {
        $action = $this->parameter->getAction();

        $params = $this->parameter->getParams();

        $content = product($params);
        $template = <<<EOF
    {$content['doc']}
    public function $action({$content['input_param']})
    {
        
    }       
EOF;
        $result = append($this->savePath(), $template);

        return $result;
    }
}